import { useEffect, useState } from 'react';

export default function ClearEffect(props) {
  const [ data1, setData1 ] = useState(1)
  useEffect(() => {
    let a = 1;
    const clear1 = setInterval(() => {
      console.log(++a)
    }, 1000)
    
    return () => {
      clearInterval(clear1)
    }
  })
  return (
    <div>
      {data1}
    </div>
  )
}